<template>
  <div class="menu">
    <el-menu :default-active="$route.path"
             active-text-color="#ffd04b"
             router
             :unique-opened="true">
      <el-submenu v-for="(item,index) in menuList"
                  :key="index"
                  :index='item.id'
                  style="text-align: left;">
        <template slot="title">

          <span>{{item.title}}</span>
        </template>
        <el-menu-item-group v-if="isSetserveruserpass==1">
          <el-menu-item v-for="child in item.children"
                        :key="child.id"
                        :index='child.index'>{{child.childtitle}}</el-menu-item>
        </el-menu-item-group>
        <el-menu-item-group v-if="isSetserveruserpass==0">
          <el-menu-item v-for="child in item.children"
                        :key="child.id"
                        :index='child.index'
                        v-if="child.qx==true">{{child.childtitle}}</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
  </div>
</template>

<script>
import { setStore, getStore } from '../router/mUtils'
export default {
  name: 'Slider',
  data () {
    return {
      isSetserveruserpass: '',
      menuList: [
        {
          id: '1',
          title: '应用管理',
          icon: 'el-icon-location',
          children: [
            {
              index: '/projectInfo',
              childtitle: '项目信息',
              qx: true,
            },
            {
              index: '/application',
              childtitle: '应用信息',
              qx: true,
            },
            /*{
              index:'/deploy',
              childtitle:'应用部署信息',
              qx:true,
            },*/
            {
              index: '/appServiceDeploy',
              childtitle: '应用部署维护',
              qx: true,
            },
            {
              index: '/system',
              childtitle: '系统信息',
              qx: true,
            },
            {
              index: '/db',
              childtitle: '数据库信息',
              qx: true,
            },
            /* {
               index:'/timer',
               childtitle:'应用定时器',
               qx:true,
             },*/
            {
              index: '/depotManager',
              childtitle: '仓库管理',
              qx: true,
            },
            {
              index: '/branchManage',
              childtitle: '分支管理',
              qx: true,
            },
            {
              index: '/projectDependencies',
              childtitle: '项目依赖模块',
              qx: true,
            },
          ]
        },
        {
          id: '2',
          title: '服务器管理',
          icon: 'el-icon-location',
          children: [
            {
              index: '/machine',
              childtitle: '物理机管理',
              qx: true,
            },
            {
              index: '/server',
              childtitle: '服务器信息',
              qx: true,
            },
            {
              index: '/componentService',
              childtitle: '服务器组件信息',
              qx: true,
            },
            {
              index: '/applyServer',
              childtitle: '申请服务器',
              qx: true,
            },
            {
              index: '/serverLog',
              childtitle: '服务器应用日志管理',
              qx: true,
            },
            {
              index: '/serverLogMigration',
              childtitle: '应用日志迁移',
              qx: true,
            },
          ]
        },
        {
          id: '3',
          title: '用户管理',
          icon: 'el-icon-location',
          children: [
            /* {
               index:'/user',
               childtitle:'用户信息',
               qx:true,
             },*/
            {
              index: '/userManager',
              childtitle: '人员管理',
              qx: true,
            },
            {
              index: '/workGroup',
              childtitle: '工作组管理',
              qx: true,
            },
            /*{
              index:'/command',
              childtitle:'常用命令',
              qx:true,
            },*/
          ]
        },
        {
          id: '4',
          title: '参数管理',
          icon: 'el-icon-location',
          children: [
            {
              index: '/ProIpParam',
              childtitle: '正式场ip段参数',
              qx: true,
            },
            {
              index: '/DbPortParam',
              childtitle: '数据库端口参数',
              qx: true,
            },
            {
              index: '/DbTypeParam',
              childtitle: '数据库类型参数',
              qx: true,
            },
            {
              index: '/DevFrameParam',
              childtitle: '开发框架参数',
              qx: true,
            },
            {
              index: '/DevLanguageParam',
              childtitle: '开发语言参数',
              qx: true,
            },
            {
              index: '/EnvParam',
              childtitle: '应用环境参数',
              qx: true,
            },
            {
              index: '/DeployCont',
              childtitle: '部署容器参数',
              qx: true,
            },
            {
              index: '/ServerTagParam',
              childtitle: '服务器标签参数',
              qx: true,
            },
            {
              index: '/DeployTagParam',
              childtitle: '应用部署标签参数',
              qx: true,
            },
            {
              index: '/DictData',
              childtitle: '数据字典',
              qx: true,
            }
          ]
        },
        {
          id: '5',
          title: '发版管理',
          icon: 'el-icon-location',
          children: [
            {
              index: '/release',
              childtitle: '测试场发版',
              qx: true,
            },
            {
              index: '/proRelease',
              childtitle: '正式场发版',
              qx: true,
            },
            {
              index: '/autoDeploy',
              childtitle: '自动部署',
              qx: true,
            },
            /* {
               index:'/onlineApply',
               childtitle:'上线申请/审核',
               qx:true,
             },*/
            {
              index: '/applyRelease',
              childtitle: '发版申请',
              qx: true,
            },
          ]
        },
        {
          id: '6',
          title: '需求池',
          icon: 'el-icon-location',
          children: [
            {
              index: '/DemandPool',
              childtitle: '需求池',
              qx: true,
            },
            {
              index: '/Demand',
              childtitle: '需求管理',
              qx: true,
            },
            {
              index: '/DemandFilter',
              childtitle: '所有需求',
              qx: true,
            },
          ]
        },
        {
          id: '7',
          title: '消息管理',
          icon: 'el-icon-location',
          children: [
            {
              index: '/earlyConfig',
              childtitle: '预警消息配置',
              qx: true,
            },
            {
              index: '/messagePush',
              childtitle: '发送消息',
              qx: true,
            },
          ]
        },
        {
          id: '8',
          title: '任务管理',
          icon: 'el-icon-location',
          children: [
            {
              index: '/MyTask',
              childtitle: '我的任务',
              qx: true,
            },
            {
              index: '/remindSet',
              childtitle: '提醒设置',
              qx: true,
            },
          ]
        },

        // {
        //   id:'9',
        //   title: '权限管理',
        //   icon:'el-icon-location',
        //   children:[
        //     {
        //       index:'/roleManager',
        //       childtitle:'角色管理',
        //       qx:true,
        //     },
        //     {
        //       index:'/permissionManager',
        //       childtitle:'权限管理',
        //       qx:true,
        //     },
        //   ]
        // },
        {
          id: '10',
          title: '系统管理',
          icon: 'el-icon-location',
          children: [
            {
              index: '/operationRecord',
              childtitle: '操作日志管理',
              qx: true,
            },
          ]
        },
        {
          id: '11',
          title: '信息监测',
          icon: 'el-icon-location',
          children: [
            {
              index: '/ApplicationHealth',
              childtitle: '应用运行情况',
              qx: true,
            },
            {
              index: '/ServerHealth',
              childtitle: '服务器运行情况',
              qx: true,
            },
          ]
        },

      ]
    }
  },
  created () {
    let userbean = getStore('userInfo');
    this.isSetserveruserpass = JSON.parse(userbean).isSetserveruserpass;
  },

}
</script>
<style lang="less">
.menu {
  position: absolute !important;
  background: url(../assets/img/menu_bg.png) !important;
  background-repeat: repeat-y !important;
  width: 285px !important;
  height: 100%;
  left: 0 !important;
  top: 118px !important;
  bottom: 0 !important;
  background-size: cover;
  background-position: center;
}
.el-menu {
  width: 265px !important;
  float: right !important;
  border: none !important;
  background-color: transparent !important;
}
.el-submenu {
  margin-top: 14px !important;
  border-radius: 6px !important;
  overflow: hidden !important;
  .icon {
    width: 10px !important;
    height: 10px !important;
    display: inline-block !important;
    margin: -3px 14px 0 0 !important;
    background: url(../assets/img/icon_plus.png) center center no-repeat !important;
  }
  &.is-opened {
    .icon {
      background: url(../assets/img/icon_minus.png) center center no-repeat !important;
    }
  }
}
.el-submenu__title {
  color: #d5eeff !important;
  font-size: 16px !important;
  height: 45px !important;
  line-height: 45px !important;
  background-color: #0066cc !important;
}
.el-submenu__title i {
  color: #fff !important;
  font-size: 18px !important;
  margin-top: -9px !important;
}
.el-menu-item {
  width: 146px !important;
  height: 36px;
  line-height: 36px;
  margin-left: 30px;
  background-image: url(../assets/img/icon_angle.png) !important;
  background-repeat: no-repeat !important;
  background-position: 28px center !important;
  color: #d5eeff !important;
  font-size: 16px !important;
  border-radius: 20px !important;
  &:first-child {
    margin-top: 14px !important;
  }
  &:hover {
    background-color: transparent !important;
  }
  &.is-active {
    background-color: #fff !important;
    color: #0099d9 !important;
    background-image: url(../assets/img/icon_cir.png) !important;
    background-position: 25px center !important;
  }
}
</style>
